<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建学校</title>
    <link rel="stylesheet" type="text/css" href="../plugin/layui/css/layui.css" />
    <script src="../plugin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script>
        layui.use(['form','layer','jquery'], function(){
            var form = layui.form,layer=layui.layer,$=layui.jquery;
            //监听提交
            form.on('submit(add)', function(data){
                //layer.alert(JSON.stringify(data.field));
                $.post("../school/create",data.field,function (res) {
                   if (res.code==0){
                       layer.msg(res.message,{icon: 1})
                       layer.closeAll("iframe");
                   }else {
                       layer.msg(res.message,{icon: 5})
                   }
                });
                return false;
            });
        });
    </script>
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">学校名</label>
        <div class="layui-input-block">
            <input type="text" name="sname" required  lay-verify="required" placeholder="请输入学校名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码框</label>
        <div class="layui-input-inline">
            <input type="password" name="spassword" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" required  lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="add">创建</button>
        </div>
    </div>
</form>
</body>
</html>